import 'package:flutter_crud_test_amir_rabbani/data/datasources/customer_datasource.dart';
import 'package:flutter_crud_test_amir_rabbani/data/local/my_database.dart';
import 'package:flutter_crud_test_amir_rabbani/data/repositories/customer_repository.dart';
import 'package:flutter_crud_test_amir_rabbani/domain/repositories/customer_repository_impl.dart';
import 'package:flutter_crud_test_amir_rabbani/domain/usecases/create_customer_usecase.dart';
import 'package:flutter_crud_test_amir_rabbani/domain/usecases/delete_customer_usecase.dart';
import 'package:flutter_crud_test_amir_rabbani/domain/usecases/edit_customer_usecase.dart';
import 'package:flutter_crud_test_amir_rabbani/domain/usecases/read_by_id_customer_usecase.dart';
import 'package:flutter_crud_test_amir_rabbani/domain/usecases/read_customer_usecase.dart';
import 'package:flutter_crud_test_amir_rabbani/peresenter/crud/controller/add_customer_controller.dart';
import 'package:flutter_crud_test_amir_rabbani/peresenter/crud/controller/crud_controller.dart';
import 'package:get/get.dart';

class CrudBinding extends Bindings {
  @override
  void dependencies() {
    /// DataBase
    Get.put<AppDatabase>(AppDatabase());

    /// DataSource
    Get.lazyPut<CustomerDataSource>(() => CustomerDataSourceImpl(Get.find()));

    /// Repositories
    Get.lazyPut<CustomerRepository>(() => CustomerRepositoryImpl(Get.find()));

    /// UseCases
    Get.lazyPut<CreateCustomerUseCase>(() => CreateCustomerUseCase(Get.find()));
    Get.lazyPut<DeleteCustomerUseCase>(() => DeleteCustomerUseCase(Get.find()));
    Get.lazyPut<EditCustomerUseCase>(() => EditCustomerUseCase(Get.find()));
    Get.lazyPut<ReadByIdCustomerUseCase>(
        () => ReadByIdCustomerUseCase(Get.find()));
    Get.lazyPut<ReadCustomerUseCase>(() => ReadCustomerUseCase(Get.find()));

    /// Controllers
    Get.lazyPut<CrudController>(() => CrudController(
          Get.find(),
          Get.find(),
          Get.find(),
          Get.find(),
          Get.find(),
        ));
    Get.lazyPut<AddCustomerController>(() => AddCustomerController(
          Get.find(),
          Get.find(),
          Get.find(),
        ));
  }
}
